Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move feegrant ante to auth ante #8682

Merged
merged 39 commits into from
Mar 23, 2021
Merged

move feegrant ante to auth ante #8682

merged 39 commits into from
Mar 23, 2021

Conversation

atheeshp
Copy link
Contributor

Description

closes: #8611


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@codecov
Copy link

codecov bot commented Feb 24, 2021

Codecov Report

Merging #8682 (7ca23a6) into master (e30959c) will increase coverage by 0.31%.
The diff coverage is 72.91%.

❗ Current head 7ca23a6 differs from pull request most recent head 148294a. Consider uploading reports for the commit 148294a to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #8682      +/-   ##
==========================================
+ Coverage   58.91%   59.22%   +0.31%     
==========================================
  Files         574      568       -6     
  Lines       32122    31804     -318     
==========================================
- Hits        18924    18837      -87     
+ Misses      10979    10760     -219     
+ Partials     2219     2207      -12     
Impacted Files Coverage Δ
x/feegrant/keeper/keeper.go 78.65% <ø> (ø)
x/auth/ante/ante.go 66.66% <57.89%> (-33.34%) ⬇️
simapp/app.go 82.84% <81.81%> (-0.50%) ⬇️
x/auth/ante/fee.go 78.43% <83.33%> (+4.07%) ⬆️
x/bank/keeper/genesis.go 68.42% <0.00%> (-10.53%) ⬇️
x/bank/keeper/send.go 75.00% <0.00%> (-8.63%) ⬇️
x/bank/types/genesis.go 52.00% <0.00%> (-5.58%) ⬇️
x/gov/legacy/v043/store.go 84.61% <0.00%> (-1.10%) ⬇️
x/staking/types/msg.go 54.92% <0.00%> (-0.63%) ⬇️
x/genutil/client/cli/migrate.go 68.42% <0.00%> (ø)
... and 4 more

x/auth/ante/ante.go Outdated Show resolved Hide resolved
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

x/auth/ante/ante.go Outdated Show resolved Hide resolved
x/auth/ante/ante.go Outdated Show resolved Hide resolved
@atheeshp atheeshp requested a review from aaronc March 5, 2021 09:31
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So reading this PR again, I still think it's quite confusing.

I believe we initially wanted separate decorators, because feegrant seemed like an optional module, which apps could choose to include or not.

TBH right now I really wish to see it as a core module that will be in most/all chains, so I propose @aaronc's (a) solution: to have one single decorator in x/auth that handles everything related to fees.

So:

  • we remove RejectFeeGranterDecorator and DeductGrantedFeeDecorator
  • we put all their logic in the single DeductFeeDecorator (it takes a nullable FeeGrantKeeper as argument)

It will also be easier to understand the fee deduction logic in this case.

Sorry @atheeshp again for not having thought this through at first.

@atheeshp
Copy link
Contributor Author

atheeshp commented Mar 5, 2021

So reading this PR again, I still think it's quite confusing.

I believe we initially wanted separate decorators, because feegrant seemed like an optional module, which apps could choose to include or not.

TBH right now I really wish to see it as a core module that will be in most/all chains, so I propose @aaronc's (a) solution: to have one single decorator in x/auth that handles everything related to fees.

So:

* we remove RejectFeeGranterDecorator and DeductGrantedFeeDecorator

* we put all their logic in the single DeductFeeDecorator (it takes a nullable FeeGrantKeeper as argument)

It will also be easier to understand the fee deduction logic in this case.

Sorry @atheeshp again for not having thought this through at first.

Ah, yes I think I misunderstood what @aaronc is saying here, thanks for making it clear @AmauryM .

@orijbot
Copy link

orijbot commented Mar 18, 2021

@orijbot
Copy link

orijbot commented Mar 18, 2021

Comment on lines +378 to +385
anteHandler, err := ante.NewAnteHandler(
ante.HandlerOptions{
AccountKeeper: app.AccountKeeper,
BankKeeper: app.BankKeeper,
SignModeHandler: encodingConfig.TxConfig.SignModeHandler(),
FeegrantKeeper: app.FeeGrantKeeper,
SigGasConsumer: ante.DefaultSigVerificationGasConsumer,
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alessio @jgimeno can someone at your team take a look at this? Just want to make sure you're all aware and onboard with us moving positional parameters into an options struct here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verbal ACK from @alexanderbez on our SDK call today

@aaronc aaronc dismissed their stale review March 18, 2021 16:24

Change requests have been addressed

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

x/auth/ante/ante.go Outdated Show resolved Hide resolved
x/auth/ante/ante.go Outdated Show resolved Hide resolved
x/auth/ante/ante.go Outdated Show resolved Hide resolved
x/auth/ante/ante.go Outdated Show resolved Hide resolved
x/auth/ante/fee.go Outdated Show resolved Hide resolved
@fdymylja fdymylja self-requested a review March 19, 2021 17:01
Copy link
Contributor

@fdymylja fdymylja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, can we add a changelog entry?

@orijbot
Copy link

orijbot commented Mar 20, 2021

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK'd - pending changelog entry.

Comment on lines -284 to -286
func TestAnteTestSuite(t *testing.T) {
suite.Run(t, new(AnteTestSuite))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove this, the test cases in AnteTestSuite won't run.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suite is no longer required, since all tests which are in x/feegrant/ante moved to x/auth/ante and using the test suite from the same package(x/auth/ante).

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changelog added, I'm putting automerge on!

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Mar 22, 2021
@mergify mergify bot merged commit 025d226 into master Mar 23, 2021
@mergify mergify bot deleted the atheesh/move_feegrant_ante branch March 23, 2021 07:31
@aleem1314 aleem1314 mentioned this pull request Apr 2, 2021
3 tasks
@atheeshp atheeshp mentioned this pull request Apr 9, 2021
9 tasks
This was referenced Apr 20, 2021
larry0x pushed a commit to larry0x/cosmos-sdk that referenced this pull request May 22, 2023
* move feegrant ante to auth ante

* update ante builder

* remove commented code

* review changes

* fix lint

* review changes

* review changes

* review changes

* review changes

* fix ante builder

* review changes

* update ante builder with options struct

* review changes

* review changes

* add changelog

Co-authored-by: Amaury <1293565+amaurym@users.noreply.github.com>
Co-authored-by: Aaron Craelius <aaron@regen.network>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor fee_grant AnteHandler to x/auth
9 participants